// eslint-disable-next-line import/no-extraneous-dependencies
import type { Request, Response } from 'express';

const city = require('./geographic/city.json');
const province = require('./geographic/province.json');

function getProvince(_: Request, res: Response) {
  return res.json({
    data: province,
  });
}

function getCity(req: Request, res: Response) {
  return res.json({
    data: city[req.params.province],
  });
}

function getCurrentUse(req: Request, res: Response) {
  return res.json({
    data: {
      name: '李纪',
        avatar: 'https://liji-1300594141.cos.ap-beijing.myqcloud.com/14095c85b577b70d99f8428bc5e793d.jpg',
        userid: '00000001',
        email: 'ji.li@percent.cn',
        signature: '海纳百川，有容乃大',
        title: '全栈开发工程师',
        group: '某某－某某某事业群－某某平台部－某某技术部－FE',
        tags: [
          {
            key: '0',
            label: '很有想法的',
          },
          {
            key: '1',
            label: '专注设计',
          },
          {
            key: '2',
            label: '辣~',
          },
          {
            key: '3',
            label: '大长腿',
          },
          {
            key: '4',
            label: '川妹子',
          },
          {
            key: '5',
            label: '海纳百川',
          },
        ],
        notifyCount: 12,
        unreadCount: 11,
        country: 'China',
        // access: getAccess(),
        geographic: {
          province: {
            label: '辽宁省',
            key: '330000',
          },
          city: {
            label: '沈阳市',
            key: '330100',
          },
        },
        address: '黄河北大街 253 号',
        phone: '0752-268888888',
      },
  });
}
// 代码中会兼容本地 service mock 以及部署站点的静态数据
export default {
  // 支持值为 Object 和 Array
  'GET  /api/accountSettingCurrentUser': getCurrentUse,
  'GET  /api/geographic/province': getProvince,
  'GET  /api/geographic/city/:province': getCity,
};
